package com.bjtraffic.gov.info.manager.service;

import com.bjtraffic.gov.info.manager.dao.ManagerDao;
import com.bjtraffic.gov.info.manager.domain.Manager;

import java.util.ArrayList;

public class ManagerService {
    //1.创建库管对象
    ManagerDao dao = new ManagerDao();

    public boolean land(String id,String name) {
        //2.指挥库管对象调用登录方法,方法会获得一个ArrayList集合的对象
        ArrayList<Manager> manList = dao.land();
        //3.使用标记位思想定义一个flag变量记录,假设为false
        boolean flag = false;
        //4.遍历集合
        for (Manager man : manList) {
            //5.如果用户输入的工号和姓名在集合中存在则让flag记录true
            if(id.equals(man.getId()) && name.equals(man.getName())){
                flag = true;
            }
        }
        //6.返回flag
        return flag;
    }
}
